home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / BackMisc.py < prev    next >
Encoding:
Text File  |  2000-11-16  |  19.1 KB  |  689 lines

  1. #################################################################
  2. ###                                                            ##
  3. ###  If you cast a spell from the hidden past on the darker    ##
  4. ###  site at the godess place, nevermind the doomed place of   ##
  5. ###  the damns and unholls bones.                              ##
  6. ###                                        NoSenseMan          ##
  7. #################################################################
  8.  
  9. import darfuncs
  10. import Bladex
  11. import Damage
  12. import AbreCam
  13. import Actions
  14. import EnemyTypes
  15. import PhantonFX
  16. import GenFX
  17. import ItemTypes
  18. import Reference
  19. import Auras
  20. import Blood
  21. import Menu
  22. import types
  23. import AuxFuncs
  24.  
  25.  
  26. def GetSectorIdx(pos):
  27.     if type(pos)==types.StringType:
  28.         return pos
  29.     else:
  30.         return Bladex.GetSector(pos[0],pos[1],pos[2]).Index
  31.  
  32.  
  33. ############################
  34. #                          #
  35. #  CHAOS KNIGHT GENERATOR  #
  36. #                          #
  37. ############################
  38.  
  39.  
  40. _AppearsCagazo=Bladex.CreateSound("..\\..\\Sounds\\AparicionEnric2.wav","AppearsCagazo")
  41. _AppearsCagazo.MaxDistance=200000.0
  42. _AppearsCagazo.MinDistance=20000.0
  43.  
  44. ChaosKnightActivated = 1
  45.  
  46. def MuereCaos(caosname):
  47.     chaosk1 = Bladex.GetEntity(caosname)
  48.     chaosk1.Data.PrepareDisappearance()
  49.     chaosk1.Data.Disappear(caosname)
  50.     
  51.  
  52.  
  53. def ChaosAbreCam(per):
  54.     AbreCam.PTS=[]
  55.     
  56.     AbreCam.PTS.append((per.Position[0]-3000,per.Position[1]-1000, per.Position[2]-3000),per.Position,0.01)
  57.     AbreCam.PTS.append((per.Position[0]-3000,per.Position[1]-1000, per.Position[2]+3000),per.Position,3.5)
  58.     AbreCam.PTS.append((per.Position[0]+3000,per.Position[1]-1000, per.Position[2]+3000),per.Position,3.5)
  59.     AbreCam.PTS.append((per.Position[0]+3000,per.Position[1]-1000, per.Position[2]-3000),per.Position,3.5)
  60.     AbreCam.PTS.append((per.Position[0]-3000,per.Position[1]-1000, per.Position[2]-3000),per.Position,3.5)
  61.     AbreCam.LastTime = 0.01
  62.     
  63.     AbreCam.AbreCam()
  64.  
  65.  
  66. def CreateChaosKnightBak(Position,Angle):
  67.     global CHAOS_KNIGHT_POSITION
  68.     global CHAOS_KNIGHT_ANGLE
  69.     global CHAOS_KNIGHT_ACTIVATE
  70.     global CHAOS_KNIGHT_DEACTIVATE
  71.     global CHAOS_KNIGHT_LEVEL
  72.     
  73.     chaosk1       = Bladex.CreateEntity("ChaosKnightBak", "ChaosKnight", Position[0], Position[1], Position[2],"Person")
  74.     chaosk1.ActionAreaMin=pow(2,0)
  75.     chaosk1.ActionAreaMax=pow(2,1)
  76.     chaosk1.Angle = Angle
  77.     chaosk1.Level = CHAOS_KNIGHT_LEVEL
  78.     EnemyTypes.EnemyDefaultFuncs(chaosk1)
  79.     chaosk1.ImDeadFunc = MuereCaos
  80.     
  81.     chaosk1.Data.DamageFactorNone=0.15
  82.     chaosk1.Data.DamageFactorLight=0.35
  83.     chaosk1.Data.DamageFactorHeavy=0.35
  84.     chaosk1.Data.PrepareWeapons("Espadon", "Escudon")
  85.     chaosk1.SetOnFloor()
  86.     darfuncs.HideBadGuy(chaosk1.Name)
  87.     
  88.  
  89. def ParticulateAppears(PersonName = "Player1"):
  90.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  91.     wps.PersonName=PersonName
  92.     wps.ParticleType="EnergyConc"
  93.     wps.Time2Live=60
  94.     wps.RandomVelocity=0
  95.     wps.Velocity=0,0,0
  96.     wps.NormalVelocity=-5.0
  97.     wps.YGravity=0
  98.     wps.DeathTime=Bladex.GetTime()+1.5    
  99.     wps.PPS=600
  100.     Bladex.GetEntity(PersonName).Alpha = 0.0
  101.     PhantonFX.Delta = 0.015
  102.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.0, PhantonFX.AppearsChar,(PersonName,))
  103.     
  104. def AppearsChaosKnightBak():
  105.     global CHAOS_KNIGHT_POSITION
  106.     global CHAOS_KNIGHT_ANGLE
  107.     global CHAOS_KNIGHT_ACTIVATE
  108.     global CHAOS_KNIGHT_DEACTIVATE
  109.     global CHAOS_KNIGHT_LEVEL
  110.     global EXEC_IN_CHAOS_KNIGHT_APPEARING
  111.     global ChaosKnightActivated
  112.     
  113.     if not ChaosKnightActivated:
  114.         return
  115.  
  116.     chaosk1 = Bladex.GetEntity("ChaosKnightBak")
  117.     darfuncs.UnhideBadGuy(chaosk1.Name)
  118.     Bladex.AddScheduledFunc(Bladex.GetTime()+15.0, darfuncs.UnhideBadGuy,(chaosk1.Name,))
  119.     chaosk1.Blind=1
  120.     chaosk1.Deaf=1
  121.     chaosk1.Alpha = 0.0
  122.     chaosk1.Data.Appear()
  123.     ChaosAbreCam(chaosk1)
  124.     ParticulateAppears(chaosk1.Name)
  125.     Actions.TurnToFaceEntityNow("ChaosKnightBak","Player1")
  126.  
  127.     for pos in CHAOS_KNIGHT_DEACTIVATE:
  128.         darfuncs.EnterSecIdEvent(pos,TranslateChaos)
  129.     if EXEC_IN_CHAOS_KNIGHT_APPEARING:
  130.         EXEC_IN_CHAOS_KNIGHT_APPEARING()
  131.     
  132.  
  133. def ParticulateDisappears(PersonName = "Player1"):
  134.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  135.     wps.PersonName=PersonName
  136.     wps.ParticleType="EnergyDissip"
  137.     wps.Time2Live=60
  138.     wps.RandomVelocity=0
  139.     wps.Velocity=0,0,0
  140.     wps.NormalVelocity=5.0
  141.     wps.YGravity=0
  142.     wps.DeathTime=Bladex.GetTime()+1.5    
  143.     wps.PPS=600
  144.     Bladex.GetEntity(PersonName).Alpha = 1.0
  145.     PhantonFX.Delta  = 0.015
  146.     PhantonFX.SecAgo = 0
  147.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.0, PhantonFX.DisappearsChar,(PersonName,BorraCaos))
  148.  
  149. def BorraCaos(ent):    
  150.     Bladex.AddScheduledFunc(Bladex.GetTime()+0.2, PrepareChaosAppears2,())
  151.     ch = Bladex.GetEntity("ChaosKnightBak")
  152.     ch.Data.InteruptActions("ChaosKnightBak")
  153.     darfuncs.HideBadGuy("ChaosKnightBak")
  154.     
  155. def TranslateChaos():
  156.     chaosk1 = Bladex.GetEntity("ChaosKnightBak")
  157.     if chaosk1:
  158.         if chaosk1.Life > 0:
  159.             chaosk1.Freeze()
  160.             ParticulateDisappears("ChaosKnightBak")
  161.  
  162. def AppearsChaosKnightBak2():
  163.     global CHAOS_KNIGHT_POSITION
  164.     global CHAOS_KNIGHT_ANGLE
  165.     global CHAOS_KNIGHT_ACTIVATE
  166.     global CHAOS_KNIGHT_DEACTIVATE
  167.     global CHAOS_KNIGHT_LEVEL
  168.     global ChaosKnightActivated
  169.     
  170.     if not ChaosKnightActivated:
  171.         return
  172.  
  173.     chaosk1 = Bladex.GetEntity("ChaosKnightBak")
  174.     darfuncs.UnhideBadGuy(chaosk1.Name)
  175.     ParticulateAppears(chaosk1.Name)
  176.     Actions.TurnToFaceEntityNow("ChaosKnightBak","Player1")
  177.     for pos in CHAOS_KNIGHT_DEACTIVATE:
  178.         darfuncs.EnterSecIdEvent(pos,TranslateChaos)
  179.  
  180.  
  181. def DeactivateChaosWeapon(EntityName, EventName):
  182.     
  183.  
  184.     if EventName=="ChkDisapR":
  185.         weapon=Bladex.GetEntity(Bladex.GetEntity(EntityName).InvRight)
  186.     else:
  187.         weapon=Bladex.GetEntity(Bladex.GetEntity(EntityName).InvLeft)
  188.  
  189.     weapon.RasterMode  ="Read"
  190.     weapon.Alpha       = 0
  191.  
  192.     wps=Bladex.CreateEntity("WPS", "Entity Particle System Dobj", 0.0, 0.0, 0.0)
  193.     wps.ObjectName=weapon.Name
  194.     wps.ParticleType="EnergyDissip"
  195.     wps.PPS=400
  196.     wps.YGravity=0.0
  197.     wps.Friction=0.0
  198.     wps.Velocity=0.0, 0.0, 0.0
  199.     wps.RandomVelocity=2.0
  200.     wps.NormalVelocity=6.0
  201.     wps.Time2Live=60
  202.     wps.DeathTime=Bladex.GetTime()+1.5
  203.  
  204. def PrepareChaosAppears2():
  205.     global CHAOS_KNIGHT_POSITION
  206.     global CHAOS_KNIGHT_ANGLE
  207.     global CHAOS_KNIGHT_ACTIVATE
  208.     global CHAOS_KNIGHT_DEACTIVATE
  209.     global CHAOS_KNIGHT_LEVEL
  210.     
  211.     pers=Bladex.CreateEntity("ChaosKnightBak","ChaosKnight",CHAOS_KNIGHT_POSITION[0],CHAOS_KNIGHT_POSITION[1],CHAOS_KNIGHT_POSITION[2],"Person")
  212.     pers.ActionAreaMin=pow(2,0)
  213.     pers.ActionAreaMax=pow(2,1)
  214.     pers.Angle    = CHAOS_KNIGHT_ANGLE
  215.     
  216.     EnemyTypes.EnemyDefaultFuncs(pers)
  217.     
  218.     pers.Data.PrepareWeapons("Espadon", "Escudon")    
  219.     Actions.TakeObject(pers.Name,"EspadonChaosKnightBak")
  220.     Actions.TakeObject(pers.Name,"EscudonChaosKnightBak")
  221.     
  222.     pers.ImDeadFunc = MuereCaos
  223.  
  224.     
  225.     
  226.     pers.AddAnmEventFunc("ChkDisapL", DeactivateChaosWeapon)
  227.     pers.AddAnmEventFunc("ChkDisapR", DeactivateChaosWeapon)
  228.  
  229.     pers.SetOnFloor()
  230.     darfuncs.HideBadGuy(pers.Name)
  231.  
  232.     for pos in CHAOS_KNIGHT_ACTIVATE:
  233.         darfuncs.EnterSecIdEvent(pos,AppearsChaosKnightBak2)
  234.     
  235. #
  236. # Interface
  237. #
  238.  
  239. CHAOS_KNIGHT_LEVEL             = 15
  240. CHAOS_KNIGHT_POSITION          = 300029.603984, 8180.76682918, -1209.8189804
  241. CHAOS_KNIGHT_ANGLE             = 0
  242. CHAOS_KNIGHT_ACTIVATE          = []
  243. CHAOS_KNIGHT_DEACTIVATE        = []
  244. TIME_BEFORE_PLAYER_APPEARING   = 1.5
  245. EXEC_IN_PLAYER_APPEARING       = ""
  246. EXEC_IN_CHAOS_KNIGHT_APPEARING = ""
  247.  
  248. def PlayerAppears():
  249.     import Scorer
  250.     global EXEC_IN_PLAYER_APPEARING
  251.  
  252.     darfuncs.UnhideBadGuy("Player1")
  253.     GenFX.PersonMagicallyAppearing()
  254.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, Bladex.ActivateInput, ())
  255.     Bladex.AddScheduledFunc(Bladex.GetTime()+2.0, Scorer.SetVisible, (1,))
  256.     if EXEC_IN_PLAYER_APPEARING:
  257.         EXEC_IN_PLAYER_APPEARING()
  258.  
  259. def PrevPlayerAppears():
  260.     import Scorer
  261.  
  262.     global TIME_BEFORE_PLAYER_APPEARING
  263.  
  264.     darfuncs.HideBadGuy("Player1")
  265.     Scorer.SetVisible(0)
  266.     Bladex.DeactivateInput()
  267.     AuxFuncs.FadeFrom(2.0, TIME_BEFORE_PLAYER_APPEARING)    
  268.  
  269.     Bladex.AddScheduledFunc(Bladex.GetTime()+TIME_BEFORE_PLAYER_APPEARING+2.0, PlayerAppears, ())
  270.  
  271. def PrepareChaosAppears():
  272.     global CHAOS_KNIGHT_POSITION
  273.     global CHAOS_KNIGHT_ANGLE
  274.     global CHAOS_KNIGHT_ACTIVATE
  275.     global CHAOS_KNIGHT_DEACTIVATE
  276.     global CHAOS_KNIGHT_LEVEL
  277.     
  278.     CreateChaosKnightBak(CHAOS_KNIGHT_POSITION,CHAOS_KNIGHT_ANGLE)
  279.     Blood.Evaporation = 1
  280.     #Menu.BackMap()    
  281.  
  282.     Bladex.AddScheduledFunc(Bladex.GetTime(), PrevPlayerAppears, ())
  283.     
  284.     for pos in CHAOS_KNIGHT_ACTIVATE:
  285.         darfuncs.EnterSecIdEvent(pos,AppearsChaosKnightBak)
  286.  
  287. def AddChaosAppearsSector(x,y,z):
  288.     global CHAOS_KNIGHT_ACTIVATE
  289.  
  290.     CHAOS_KNIGHT_ACTIVATE.append(Bladex.GetSector(x,y,z).Index)
  291.  
  292. def AddChaosAppearsTSector(id):
  293.     global CHAOS_KNIGHT_ACTIVATE
  294.  
  295.     CHAOS_KNIGHT_ACTIVATE.append(id)
  296.  
  297. def AddChaosDisappearsSector(x,y,z):
  298.     global CHAOS_KNIGHT_DEACTIVATE
  299.  
  300.     CHAOS_KNIGHT_DEACTIVATE.append(Bladex.GetSector(x,y,z).Index)
  301.  
  302. def AddChaosDisappearsTSector(id):
  303.     global CHAOS_KNIGHT_DEACTIVATE
  304.  
  305.     CHAOS_KNIGHT_DEACTIVATE.append(id)
  306.  
  307. def DeactivateChaos():
  308.     global ChaosKnightActivated
  309.     
  310.     ChaosKnightActivated = 0
  311.  
  312. def AddChaosDeactivationTs(id):
  313.     darfuncs.EnterSecIdEvent(id,DeactivateChaos)
  314.  
  315.  
  316.  
  317. ############################
  318. #                          #
  319. #      Little demons       #
  320. #            &             #
  321. #         Vampires         #
  322. #                          #
  323. ############################
  324.  
  325.  
  326. ##### Appears FX #####
  327.  
  328. Bladex.ReadBitMap("..\\..\\Data\\SmokePrtl3.bmp","SmokePart3")
  329. Bladex.AddParticleGType("DeathCloud","SmokePart3",Reference.B_PARTICLE_GTYPE_MUL,16)
  330.  
  331.  
  332. for i in range(16):
  333.     aux=(16.0-i)/16
  334.     r=255
  335.     g=255
  336.     b=255
  337.     a=0
  338.     if aux < 0.5:
  339.         size = aux*512
  340.     else:
  341.         size = (1-aux)*512
  342.     Bladex.SetParticleGVal("DeathCloud",i,r,g,b,a,size)
  343.  
  344. def DeathAppears(PersonName = "Player1",pos=(0,0,0)):
  345.     time=Bladex.GetTime()
  346.     aura=Auras.MakeAura(PersonName,0.4,   ( 50, 1.0 , 0.0, 0, 0, 0), (), (), (2,  0.9, 0.9, 0.0, 0.9, 0.0  ,  0.9, 0.9, 0.0, 0.9, 0.8))
  347.     aura.Data.AddEvent(time+0.2,          (150, 0.5 , 0.0, 0, 0, 0), (), (), (2,  0.9, 0.9, 0.0, 0.9, 0.0  ,  0.9, 0.9, 0.0, 0.9, 0.8))
  348.     aura.Data.AddEvent(time+0.4,          (200, 0.01, 0.0, 0, 0, 0), (), (), (2,  0.9, 0.9, 0.0, 0.9, 0.0  ,  0.9, 0.9, 0.0, 0.9, 0.8))
  349.  
  350.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  351.     wps.PersonName=PersonName
  352.     wps.ParticleType="DeathCloud"
  353.     wps.Time2Live=16
  354.     wps.RandomVelocity=2.0
  355.     wps.Velocity=0,0,0
  356.     wps.NormalVelocity=20
  357.     wps.YGravity=0
  358.     wps.DeathTime=Bladex.GetTime()+0.25
  359.     wps.PPS=1024
  360.     per = Bladex.GetEntity(PersonName)
  361.     darfuncs.UnhideBadGuy(per.Name)
  362.     per.Alpha = 1.0
  363.     per.Wuea=Reference.WUEA_ENDED
  364.     per.LaunchAnmType("rlx")
  365.     per.Position = pos
  366.     per.SetOnFloor()
  367.     per.SetActiveEnemy("Player1")
  368.     Actions.TurnToFaceEntityNow(per.Name,"Player1")
  369.     _AppearsCagazo.Play(per.Position[0], per.Position[1], per.Position[2], 0)
  370.     
  371. def DeathDisappears(PersonName = "Player1"):
  372.     wps=Bladex.CreateEntity(PersonName+"WPS", "Entity Particle System Dperson", 0.0, 0.0, 0.0)
  373.     wps.PersonName=PersonName
  374.     wps.ParticleType="DeathCloud"
  375.     wps.Time2Live=16
  376.     wps.RandomVelocity=2.0
  377.     wps.Velocity=0,0,0
  378.     wps.NormalVelocity=2
  379.     wps.YGravity=0
  380.     wps.DeathTime=Bladex.GetTime()+0.25
  381.     wps.PPS=1024
  382.     per = Bladex.GetEntity(PersonName)    
  383.     per.Data.InteruptActions(per.Name)
  384.     darfuncs.HideBadGuy(per.Name)
  385.     _AppearsCagazo.Play(per.Position[0], per.Position[1], per.Position[2], 0)
  386.     
  387.  
  388.             
  389. ##### Sector controllers #####
  390.  
  391. SECTOR_PROCS       = {}
  392.  
  393. LastSectorIdx      = None
  394. SECTOR_COUNT       = {}
  395.  
  396. def RemoveSector(idx):
  397.     global SECTOR_PROCS
  398.     
  399.     if SECTOR_PROCS.has_key(idx):
  400.         del  SECTOR_PROCS[idx]
  401.  
  402. def AddSectorCount(pos,Demons,Vampires):
  403.     global SECTOR_COUNT
  404.     
  405.     idx = GetSectorIdx(pos)
  406.     SECTOR_COUNT[idx] = [Demons,Vampires,[]]
  407.     return idx
  408.     
  409. def AddSectorDelete(idx,pos):
  410.     global SECTOR_COUNT
  411.     
  412.     SECTOR_COUNT[idx][2].append(GetSectorIdx(pos))
  413.  
  414. def OnEnterSectorProc(sector):
  415.     global SECTOR_PROCS
  416.     global SECTOR_COUNT
  417.     global LastSectorIdx
  418.     
  419.     if SECTOR_PROCS.has_key(sector):
  420.         if SECTOR_COUNT.has_key(sector):
  421.             LastSectorIdx = sector
  422.  
  423.         for i in SECTOR_PROCS[sector]:
  424.             apply(i[0],i[1])
  425.         
  426.         for i in SECTOR_PROCS.keys():
  427.             if i != sector:
  428.                 darfuncs.EnterSecIdEvent(i,OnEnterSectorProc)
  429.  
  430. def ActivateSectorProcs():
  431.     global SECTOR_PROCS
  432.     
  433.     for i in SECTOR_PROCS.keys():
  434.         darfuncs.EnterSecIdEvent(i,OnEnterSectorProc)
  435.     
  436. def AddSectorFunction(pos,func,param):
  437.     global SECTOR_PROCS
  438.  
  439.     idx = GetSectorIdx(pos)
  440.     if SECTOR_PROCS.has_key(idx):
  441.         SECTOR_PROCS[idx].append((func,param))
  442.     else:
  443.         SECTOR_PROCS[idx] =[(func,param)]
  444.  
  445. ##### Enemies controller #####
  446. L_Vamp             = []
  447. L_Little_Demon     = []
  448.  
  449. def AddVampires(Num,ValidPos,Level):
  450.     global L_Vamp
  451.  
  452.     for i in range(Num):
  453.         pers=Bladex.CreateEntity("VMP_"+`Level`+"_"+`i`,"Vamp",ValidPos[0],ValidPos[1],ValidPos[2],"Person")
  454.         pers.Angle=6.26312373572
  455.         pers.Level=Level
  456.         
  457.         Cimitarra1=Bladex.CreateEntity("VampWeapon"+`Level`+"_"+`i`,"VampWeapon",0,0,0,"Weapon")
  458.         VampShield=Bladex.CreateEntity("VampShield"+`Level`+"_"+`i`,"VampShield",0,0,0,"Weapon")
  459.         ItemTypes.ItemDefaultFuncs(Cimitarra1)
  460.         ItemTypes.ItemDefaultFuncs(VampShield)
  461.         Actions.TakeObject(pers.Name,Cimitarra1.Name)
  462.         Actions.TakeObject(pers.Name,VampShield.Name)
  463.         
  464.         #pers.ActionAreaMin=pow(2,2)
  465.         #pers.ActionAreaMax=pow(2,3)
  466.         EnemyTypes.EnemyDefaultFuncs(pers)
  467.         pers.SetOnFloor()
  468.         darfuncs.HideBadGuy(pers.Name)
  469.         pers.ImDeadFunc = MuerteBichoMolesto
  470.         
  471.         L_Vamp.append([pers.Name,0])
  472.  
  473. def AddDemons(Num,ValidPos,Level):
  474.     global L_Little_Demon
  475.  
  476.     for i in range(Num):
  477.         pers=Bladex.CreateEntity("Little_Demon_"+`Level`+"_"+`i`,"Little_Demon",ValidPos[0],ValidPos[1],ValidPos[2],"Person")
  478.         pers.Angle=6.26312373572
  479.         pers.Level=Level
  480.         #pers.ActionAreaMin=pow(2,2)
  481.         #pers.ActionAreaMax=pow(2,3)
  482.         EnemyTypes.EnemyDefaultFuncs(pers)
  483.         pers.SetOnFloor()
  484.         pers.ImDeadFunc = MuerteBichoMolesto
  485.         darfuncs.HideBadGuy(pers.Name)
  486.         
  487.         L_Little_Demon.append([pers.Name,0])
  488.  
  489. # Aparicion de un enemigo
  490. def EnemyAppear(List,Position,Time):
  491.     EneName = None
  492.     for i in List:
  493.         if not i[1]:
  494.             i[1]    = 1
  495.             EneName = i[0]
  496.             break
  497.     if EneName:        
  498.         Actions.TurnToFaceEntityNow(EneName,"Player1")
  499.         darfuncs.HideBadGuy(EneName)
  500.         Bladex.AddScheduledFunc(Bladex.GetTime()+Time, DeathAppears,(EneName,Position))
  501.         print "EnemyAppear ",EneName
  502.  
  503.  
  504. def HideEnemies():
  505.     print "HideEnemies"
  506.     global L_Little_Demon
  507.     global L_Vamp
  508.     
  509.     for i in L_Vamp:
  510.         if i[1]:
  511.             DeathDisappears(i[0])
  512.             i[1] = 0
  513.     for i in L_Little_Demon:
  514.         if i[1]:
  515.             DeathDisappears(i[0])
  516.             i[1] = 0
  517.  
  518.  
  519. def HideEnemiesSector(pos):
  520.     AddSectorFunction(pos,HideEnemies,())
  521.     
  522.  
  523. def AddVampireAppears(secPos,enePos,Time):
  524.     global L_Vamp
  525.     AddSectorFunction(secPos,EnemyAppear,(L_Vamp,enePos,Time))
  526.  
  527. def AddDemonAppears(secPos,enePos,Time):
  528.     global L_Little_Demon
  529.     AddSectorFunction(secPos,EnemyAppear,(L_Little_Demon,enePos,Time))
  530.  
  531. def MuerteBichoMolesto(Name):
  532.     global L_Little_Demon
  533.     global L_Vamp
  534.     global SECTOR_COUNT
  535.     global LastSectorIdx
  536.  
  537.     me = Bladex.GetEntity(Name)
  538.     if me.Kind == "Vamp":
  539.         for i in L_Vamp:
  540.             if i[0]==Name:
  541.                 L_Vamp.remove(i)
  542.                 break
  543.                 
  544.         DeathDisappears(Name)        
  545.         Bladex.AddScheduledFunc(Bladex.GetTime()+1.0, me.SubscribeToList,("Pin",))
  546.         SECTOR_COUNT[LastSectorIdx][1] = SECTOR_COUNT[LastSectorIdx][1]-1
  547.         if SECTOR_COUNT[LastSectorIdx][1] == 0:
  548.             for idsec in SECTOR_COUNT[LastSectorIdx][2]:
  549.                 RemoveSector(idsec)
  550.             ActivateSectorProcs()
  551.         
  552.     else:
  553.         for i in L_Little_Demon:
  554.             if i[0]==Name:
  555.                 L_Little_Demon.remove(i)
  556.                 break
  557.         me.Data.ImDeadFunc(Name)
  558.         SECTOR_COUNT[LastSectorIdx][0] = SECTOR_COUNT[LastSectorIdx][0]-1
  559.         if SECTOR_COUNT[LastSectorIdx][0] == 0:
  560.             for idsec in SECTOR_COUNT[LastSectorIdx][2]:
  561.                 RemoveSector(idsec)
  562.             ActivateSectorProcs()
  563.                 
  564.  
  565.  
  566.  
  567. def SaveData(filename):
  568.   import cPickle
  569.  
  570.   funcfile=open(filename,"wt")
  571.   p=cPickle.Pickler(funcfile)
  572.   d=(_AppearsCagazo,ChaosKnightActivated,CHAOS_KNIGHT_LEVEL,
  573.      CHAOS_KNIGHT_POSITION,CHAOS_KNIGHT_ANGLE,CHAOS_KNIGHT_ACTIVATE,
  574.      CHAOS_KNIGHT_DEACTIVATE,TIME_BEFORE_PLAYER_APPEARING,
  575.      EXEC_IN_PLAYER_APPEARING,EXEC_IN_CHAOS_KNIGHT_APPEARING,
  576.      SECTOR_PROCS,LastSectorIdx,SECTOR_COUNT,L_Vamp,L_Little_Demon)
  577.  
  578.   
  579.   p.dump(d)
  580.   funcfile.close()
  581.  
  582.  
  583.  
  584. def LoadData(filename):
  585.   import cPickle
  586.  
  587.   global _AppearsCagazo
  588.   global ChaosKnightActivated
  589.   global CHAOS_KNIGHT_LEVEL
  590.   global CHAOS_KNIGHT_POSITION
  591.   global CHAOS_KNIGHT_ANGLE
  592.   global CHAOS_KNIGHT_ACTIVATE
  593.   global CHAOS_KNIGHT_DEACTIVATE
  594.   global TIME_BEFORE_PLAYER_APPEARING
  595.   global EXEC_IN_PLAYER_APPEARING
  596.   global EXEC_IN_CHAOS_KNIGHT_APPEARING
  597.   global SECTOR_PROCS
  598.   global LastSectorIdx
  599.   global SECTOR_COUNT
  600.   global L_Vamp
  601.   global L_Little_Demon
  602.  
  603.   funcfile=open(filename,"rt")
  604.   p=cPickle.Unpickler(funcfile)
  605.   d=p.load()
  606.   funcfile.close()
  607.   print d
  608.  
  609.   
  610.   _AppearsCagazo                 = d[ 0]
  611.   ChaosKnightActivated           = d[ 1]
  612.   CHAOS_KNIGHT_LEVEL             = d[ 2]
  613.   CHAOS_KNIGHT_POSITION          = d[ 3]
  614.   CHAOS_KNIGHT_ANGLE             = d[ 4]
  615.   CHAOS_KNIGHT_ACTIVATE          = d[ 5]
  616.   CHAOS_KNIGHT_DEACTIVATE        = d[ 6]
  617.   TIME_BEFORE_PLAYER_APPEARING   = d[ 7]
  618.   EXEC_IN_PLAYER_APPEARING       = d[ 8]
  619.   EXEC_IN_CHAOS_KNIGHT_APPEARING = d[ 9]
  620.   SECTOR_PROCS                   = d[10]
  621.   LastSectorIdx                  = d[11]
  622.   SECTOR_COUNT                   = d[12]
  623.   L_Vamp                         = d[13]
  624.   L_Little_Demon                 = d[14]
  625.   
  626. """
  627. #
  628. # Sample of Enemies at back map
  629. #
  630.  
  631. import BackMisc
  632.  
  633. #
  634. # CHAOS KNIGHT
  635. #
  636.  
  637. BackMisc.CHAOS_KNIGHT_LEVEL       = 1
  638. BackMisc.CHAOS_KNIGHT_POSITION    = 16230.9184998, -735.695860989, 39699.5778343
  639. BackMisc.CHAOS_KNIGHT_ANGLE       = 0
  640.  
  641. BackMisc.AddChaosDisappearsSector(15239.4035073, -2747.16516658, 57256.1186163)
  642. BackMisc.AddChaosDisappearsSector(253.269773313, -2663.49693091, 39305.8229719)
  643. BackMisc.AddChaosDisappearsSector(15874.8334796, -1229.29468164, 19106.6487786)
  644. BackMisc.AddChaosDisappearsSector(29467.4856681, -2729.42212464, 39537.9079875)
  645.  
  646. BackMisc.AddChaosAppearsSector(16230.9184998, -735.695860989, 39699.5778343)
  647.  
  648. BackMisc.AddChaosDeactivationTs("ChauCaos")
  649.  
  650. BackMisc.PrepareChaosAppears()
  651.  
  652. #
  653. # Vampire and demons
  654. #
  655.  
  656. BackMisc.AddVampires(5,(15159, -1133, 1923),0)
  657. BackMisc.AddDemons(5,(15159, -1133, 1923),0)
  658.  
  659. idx = BackMisc.AddSectorCount(   (15417, -2189, 53450),1,1)
  660. BackMisc.AddSectorDelete(idx,(15417, -2189, 53450))
  661.     
  662. BackMisc.HideEnemiesSector((15417, -2189, 53450))
  663. BackMisc.AddDemonAppears  ((15417, -2189, 53450),( 9325, -2669, 59723),0.1)
  664. BackMisc.AddDemonAppears  ((15417, -2189, 53450),(25242, -2690, 59909),0.5)
  665. BackMisc.AddVampireAppears((15417, -2189, 53450),(16000, -2671, 65675),1.0)
  666.  
  667. BackMisc.HideEnemiesSector((15703, -690, 42391))
  668.  
  669. BackMisc.ActivateSectorProcs()
  670. # BackMisc.EnemyAppear(BackMisc.L_Little_Demon,( 9325, -2669, 59723),0.1)
  671. # BackMisc.HideEnemies()
  672. # BackMisc.L_Little_Demon
  673. # BackMisc.L_Vamp
  674.     
  675. def CambiaSangre(pos,c,dc):
  676.     for l in Bladex.GetEntitiesAt(pos[0],pos[1],pos[2],10000):
  677.         o = Bladex.GetEntity(l)
  678.         if o.Kind == 'Entity Pool':
  679.             print o.Color,o.DeepColor
  680.             o.DeepColor = dc
  681.             o.Color     = c
  682.  
  683. CambiaSangre(char.Position,(0,0,0),(0,0,0))
  684.  
  685.  
  686. """
  687. import GameState
  688. GameState.ModulesToBeSaved.append(__import__(__name__))
  689.